import { Params, Result, UPLOAD } from '@/plugins/axios';
import type { UploadType } from './namespace';
import type { ResponseResult } from '@/types/response';

class uploadApi {
  @UPLOAD('/upload/image')
  async uploadImg(@Params params: UploadType.Params, @Result res?: ResponseResult<UploadType.Result>) {
    return res?.data.url;
  }

  @UPLOAD('/upload/user-image')
  async uploadUserImg(@Params params: UploadType.Params, @Result res?: ResponseResult<UploadType.Result>) {
    return res?.data.url;
  }

  @UPLOAD('/upload/article-image')
  async uploadAritcleImg(@Params params: UploadType.Params, @Result res?: ResponseResult<UploadType.Result>) {
    return res?.data.url ?? '';
  }
}

export default new uploadApi();
